//
//  CommunityWebService.m
//  YYZB
//
//  Created by 顾悦 on 16/3/21.
//
//

#import "CommunityWebService.h"

@implementation CommunityWebService

- (void)getCommunitiesByCityID:(NSString *)cityID
                        pageNo:(NSString *)pageNo
                      pageSize:(NSString *)pageSize
             completionHanlder:(void (^)(NSArray *items, NSError *error))completionHanlder {
    NSString *URL = @"Common/GetCommunityByCityId";
    NSDictionary *params = @{
                             @"CityId": cityID,
                             @"PageSize": pageSize,
                             @"PageNo": pageNo
                             };
    NSString *URLString = [self formattedURLString:params method:URL sessionNeeded:NO];
    [self sendHTTPGetRequest:URLString completionHandler:^(id result, NSError *error) {
        if (error != nil) {
            completionHanlder(nil, error);
        } else {
            NSError *err;
            NSArray *items = [self unboxedValue:result error:&err];
            completionHanlder(items, err);
        }
    }];
}

@end
